import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/unified-authentication-server/api/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/api/userInfo',
    method: 'get'
  })
}

export function logout() {
  return request({
    url: '/unified-authentication-server/api/logout',
    method: 'post'
  })
}

export function fetchUsers(params) {
  return request({
    url: '/api/v1/users',
    method: 'get',
    params
  })
}

export function addUser(data) {
  return request({
    url: '/api/sysuser/addUser',
    method: 'post',
    data
  })
}

export function updateUser(id, data) {
  return request({
    url: `/api/sysuser/updateUser/${id}`,
    method: 'put',
    data
  })
}

export function deleteUser(id, data) {
  return request({
    url: `/api/sysuser/deleteUser/${id}`,
    method: 'delete',
    data
  })
}
export function resetPwd(id, data) {
  return request({
    url: `/api/v1/resetPassword/${id}`,
    method: 'put',
    data
  })
}

export function users(params) {
  return request({
    url: '/api/sysuser/users',
    method: 'get',
    params
  })
}

